/**
 * Change text when progress has been finished
 */
function progressFinish() {
    $('#loadingSpan').text('Your data has been downloaded!').addClass('downloaded');
}
/**
 * Add number of Record into process DIV when data are not exist in cache
 */
function init(){
    var numberSpan = '<div id="numberOfRecords"><span id="number">0</span> records have been written</div>';
    var text = $('#progress').html();
    $('#progress').html(text+numberSpan);
}
/**
 * Change number of records that have been written in excel
 * @param number
 */
function changeNumberOfRecords(number) {
    var obj = $('#number');
    obj.text(number);
}
/**
 * Show error message into obj
 * @param obj
 * @param strError
 */
function showError(obj, strError){
    $(obj).text(strError);
}
/**
 * Counter from begin to end
 * @param begin
 * @param end
 */
function counter(begin, end) {
    var time = 500;
    $({c: begin}).animate({c: end}, {
        step: function (now) {
            $("#number").text(Math.round(now))
        },
        duration: time,
        easing: "linear"
    });
}

function hideLoading(){
    $('#loading').fadeOut(400);
}


function getUrlParameter(name, source)
{
    var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(source);
    if (!results)
    {
        return 0;
    }
    return results[1] || 0;
}